<?php
/**
 * 品质明细模型
 * (model)
 */
namespace App\Models\Quality;

use App\Models\Basics\SysArea;
use App\Models\Product\ProductSku;
use App\Models\Product\ProductClassify;
use Illuminate\Database\Eloquent\Model;
class QDetail extends Model
{
    protected $table = 'quality_detail';

    protected $guarded = [];

    public function sku(){
        return $this->belongsTo(ProductSku::class,'psku_id');
    }

    public function classify(){
        return $this->belongsTo(ProductClassify::class,'classify_id');
    }

    public function area(){
        return $this->belongsTo(SysArea::class,'area_id');
    }

    /*public static function getData($re){
        foreach ($re as $row){
            $temp = [];
            $temp['report_date'] = $row->report_date;
            $temp['area_id'] = Account::$_area[$row->area_id];
            $temp['psku_code'] = $row->sku->psku_code ?? '';
            $temp['psku_cn'] = $row->sku->psku_cn ?? '';
            $temp['child_classify_id'] = isset($row->sku->child_classify_id) ? ProductClassify::getTitleById($row->sku->child_classify_id) : '';
            $temp['type'] = QDict::$_type[$row->type];
            $temp['tag'] = $row->tag;
            $temp['num'] = $row->num;
            yield $temp;
        }
    }*/

}
